package com.javaclimb.drug.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.javaclimb.drug.common.ResultMapUtil;
import com.javaclimb.drug.entity.Druginfo;
import com.javaclimb.drug.entity.ILogInfo;
import com.javaclimb.drug.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 日志信息控制层
 */
@Controller
@RequestMapping(value = "/log")
public class LogController {

    @Autowired
    private LogService logService;

    @RequestMapping("/logInfoQueryPage")
    @ResponseBody
    public Object logQueryPage(String param, @RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10")int limit){
        try{
            IPage<ILogInfo> pages=logService.selectLogPage(page,limit,param);
            return ResultMapUtil.getHashMapMysqlPage(pages);
        } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
        }
    }
}
